package cn.shopifymall.utils;

import javax.servlet.Servlet;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author 孤风雪影
 * @Email gitee.com/efairy520
 * @Date 2024/2/27 18:04
 * @Version 1.0
 */
public class Context {
    private String appName;
    private Map<String, Servlet> urlPatternMapping = new HashMap<>();

    public Context(String appName) {
        this.appName = appName;
    }

    public void addUrlPatternMapping(String urlPattern, Servlet servlet) {
        urlPatternMapping.put(urlPattern, servlet);
    }

    public Servlet getByUrlPattern(String urlPattern) {
        Servlet servlet = urlPatternMapping.get(urlPattern);
        return servlet;
    }
}
